package com.github.wxiaoqi.security.common.msg;

/**
 * Created by Ace on 2017/6/11.
 */
public class ObjectRestResponse<T> extends BaseResponse {

    T data;
    boolean rel;

    public boolean isRel() {
        return rel;
    }

    public void setRel(boolean rel) {
        this.rel = rel;
    }


    public ObjectRestResponse rel(boolean rel) {
        this.setRel(rel);
        return this;
    }


    public ObjectRestResponse<T> data(T data) {
        this.setData(data);
        return this;
    }
    
    public static <T> ObjectRestResponse<T> fail(Integer code,String message) {
    	ObjectRestResponse<T> ObjectRestResponse = new ObjectRestResponse<>(code,message);
        return ObjectRestResponse;
    }
    
    public static <T> ObjectRestResponse<T> fail(String message) {
    	ObjectRestResponse<T> ObjectRestResponse = new ObjectRestResponse<>(1,message);
    	return ObjectRestResponse;
    }
    
    public static <T> ObjectRestResponse<T> ok(T data) {
    	ObjectRestResponse<T> ObjectRestResponse = new ObjectRestResponse<>();
    	ObjectRestResponse.setData(data);
        return ObjectRestResponse;
    }
    
    public ObjectRestResponse() {
    	
    }
    
public ObjectRestResponse(Integer code,String message) {
    	super(code,message);
    }
    
    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


}
